package com.tianhua.javs.core.func.translate.ret;

import com.tianhua.javs.client.bean.JavsSegmentBean;
import com.tianhua.javs.client.bean.TranslateResultBean;
import com.tianhua.javs.client.func.ITranslatorFunc;
import com.tianhua.javs.core.annotations.Segment;
import org.springframework.stereotype.Component;

/**
 * Description:
 * date: 2022/2/12
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Component(value = "rets")
@Segment(tag = "rets",scriptFuncBean = "returnFunc")
public class Rets implements ITranslatorFunc {
    @Override
    public JavsSegmentBean translate(String shellSegment) {
        String tempShell = shellSegment.trim();
        if(tempShell.startsWith("rets(")){
            tempShell = tempShell.replaceFirst("rets","return ResultDTO.success");
            return JavsSegmentBean.getMatchInstance(tempShell);
        }
        return JavsSegmentBean.getInstance(shellSegment);
    }
}
